package com.lz.water.monitor.manager.assembler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.ObjectUtils;

import com.lz.water.monitor.entity.User;
import com.lz.water.monitor.manager.dto.UserDto;

public class UserAssembler implements Assembler<UserDto> {
	private Logger logger = LoggerFactory.getLogger("UserAssembler");
	private static final UserAssembler UserAssembler = new UserAssembler();

	private UserAssembler() {
		super();
	}

	@Override
	public UserDto toDto(Object object) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	public UserDto toDto(User user) {
		if (ObjectUtils.isEmpty(user)) {
			logger.info("---用户并不存在{}", "");
			return null;
		}
		UserDto userDto = new UserDto();
		// 设置数据
		userDto.setId(user.getId());
		userDto.setNickName(user.getNickName());
		userDto.setPassword(user.getPassword());
		userDto.setStatus(user.getStatus());
		userDto.setUserName(user.getUserName());
		return userDto;
	}

	public static UserAssembler getUserassembler() {
		return UserAssembler;
	}

}
